package logger;

import ch.qos.logback.classic.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 */
public class Main {

    public static void main(String[] args) {

        if (args.length < 2) {
            return;
        }

        String name = args[0];
        String level = args[1];


        try {
            Logger logger = LoggerFactory.getLogger(name);

            if (logger instanceof ch.qos.logback.classic.Logger) {
                ch.qos.logback.classic.Logger logback = (ch.qos.logback.classic.Logger) logger;
                logback.setLevel(Level.toLevel(level));
                System.out.println("修改logback日志级别成功. log: " + name + " , level: " + level);
                return;
            }
        } catch (NoClassDefFoundError e) {
            //            System.out.println("logback not found");
        }

        try { //log4j

            return;
        } catch (Exception e) {

        }


    }
}
